import 'package:flutter/material.dart';
import 'package:flutter/widgets.dart';

class ListViewcase extends StatelessWidget {
  const ListViewcase({Key? key}) : super(key: key);

  List<Widget> getList() {
    List<Widget> list = [];
    for (var i = 0; i < 10; i++) {
      list.add(Container(
        alignment: Alignment.center,
        margin: const EdgeInsets.all(10),
        decoration: const BoxDecoration(
          color: Colors.blue,
          borderRadius: BorderRadius.all(Radius.circular(10)),
        ),
        width: double.infinity,
        height: 100,
        child: Text("我是第${i + 1}个"),
      ));
    }
    return list;
  }

  @override
  Widget build(BuildContext context) {
    return ListView(
      children: getList(),
    );
  }
}
